

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>NFS Service &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/underscore.js"></script>
        <script src="../../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../../genindex/" />
    <link rel="search" title="Search" href="../../../search/" />
    <link rel="next" title="iSCSI Service" href="../iscsi/" />
    <link rel="prev" title="MDS Service" href="../mds/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../../" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../../">Cephadm</a> &raquo;</li>
        
          <li><a href="../">Service Management</a> &raquo;</li>
        
      <li>NFS Service</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../../_sources/cephadm/services/nfs.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../../">
          

          
            
            <img src="../../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../install/">安装 Ceph</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../">Cephadm</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../../compatibility/">Compatibility and Stability</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../install/">部署个全新的 Ceph 集群</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../adoption/">现有集群切换到 cephadm</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../host-management/">Host Management</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../">Service Management</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../mon/">MON Service</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mgr/">MGR Service</a></li>
<li class="toctree-l3"><a class="reference internal" href="../osd/">OSD Service</a></li>
<li class="toctree-l3"><a class="reference internal" href="../rgw/">RGW Service</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mds/">MDS Service</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">NFS Service</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#deploying-nfs-ganesha">Deploying NFS ganesha</a></li>
<li class="toctree-l4"><a class="reference internal" href="#service-specification">Service Specification</a></li>
<li class="toctree-l4"><a class="reference internal" href="#high-availability-nfs">High-availability NFS</a></li>
<li class="toctree-l4"><a class="reference internal" href="#further-reading">Further Reading</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../iscsi/">iSCSI Service</a></li>
<li class="toctree-l3"><a class="reference internal" href="../custom-container/">Custom Container Service</a></li>
<li class="toctree-l3"><a class="reference internal" href="../monitoring/">Monitoring Services</a></li>
<li class="toctree-l3"><a class="reference internal" href="../snmp-gateway/">SNMP Gateway Service</a></li>
<li class="toctree-l3"><a class="reference internal" href="../#service-status">Service Status</a></li>
<li class="toctree-l3"><a class="reference internal" href="../#daemon-status">Daemon Status</a></li>
<li class="toctree-l3"><a class="reference internal" href="../#service-specification">Service Specification</a></li>
<li class="toctree-l3"><a class="reference internal" href="../#daemon-placement">Daemon Placement</a></li>
<li class="toctree-l3"><a class="reference internal" href="../#removing-a-service">Removing a Service</a></li>
<li class="toctree-l3"><a class="reference internal" href="../#disabling-automatic-deployment-of-daemons">Disabling automatic deployment of daemons</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../upgrade/">Ceph 的升级</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../operations/">Cephadm operations</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../client-setup/">Client Setup</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../troubleshooting/">Troubleshooting</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../dev/cephadm/">Cephadm Feature Planning</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="nfs-service">
<span id="deploy-cephadm-nfs-ganesha"></span><h1>NFS Service<a class="headerlink" href="#nfs-service" title="Permalink to this headline">¶</a></h1>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Only the NFSv4 protocol is supported.</p>
</div>
<p>The simplest way to manage NFS is via the <code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">nfs</span> <span class="pre">cluster</span> <span class="pre">...</span></code>
commands; see <a class="reference internal" href="../../../mgr/nfs/#mgr-nfs"><span class="std std-ref">CephFS &amp; RGW Exports over NFS</span></a>.  This document covers how to manage the
cephadm services directly, which should only be necessary for unusual NFS
configurations.</p>
<div class="section" id="deploying-nfs-ganesha">
<h2>Deploying NFS ganesha<a class="headerlink" href="#deploying-nfs-ganesha" title="Permalink to this headline">¶</a></h2>
<p>Cephadm deploys NFS Ganesha daemon (or set of daemons).  The configuration for
NFS is stored in the <code class="docutils literal notranslate"><span class="pre">nfs-ganesha</span></code> pool and exports are managed via the
<code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">nfs</span> <span class="pre">export</span> <span class="pre">...</span></code> commands and via the dashboard.</p>
<p>To deploy a NFS Ganesha gateway, run the following command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><style type="text/css">
span.prompt1:before {
  content: "# ";
}
</style><span class="prompt1">ceph orch apply nfs *&lt;svc_id&gt;* <span class="o">[</span>--port *&lt;port&gt;*<span class="o">]</span> <span class="o">[</span>--placement ...<span class="o">]</span></span>
</pre></div></div><p>For example, to deploy NFS with a service id of <em>foo</em> on the default
port 2049 with the default placement of a single daemon:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph orch apply nfs foo</span>
</pre></div></div><p>See <a class="reference internal" href="../#orchestrator-cli-placement-spec"><span class="std std-ref">Daemon Placement</span></a> for the details of the placement
specification.</p>
</div>
<div class="section" id="service-specification">
<h2>Service Specification<a class="headerlink" href="#service-specification" title="Permalink to this headline">¶</a></h2>
<p>Alternatively, an NFS service can be applied using a YAML specification.</p>
<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="nt">service_type</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">nfs</span>
<span class="nt">service_id</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">mynfs</span>
<span class="nt">placement</span><span class="p">:</span>
  <span class="nt">hosts</span><span class="p">:</span>
    <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">host1</span>
    <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">host2</span>
<span class="nt">spec</span><span class="p">:</span>
  <span class="nt">port</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">12345</span>
</pre></div>
</div>
<p>In this example, we run the server on the non-default <code class="docutils literal notranslate"><span class="pre">port</span></code> of
12345 (instead of the default 2049) on <code class="docutils literal notranslate"><span class="pre">host1</span></code> and <code class="docutils literal notranslate"><span class="pre">host2</span></code>.</p>
<p>The specification can then be applied by running the following command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph orch apply -i nfs.yaml</span>
</pre></div></div></div>
<div class="section" id="high-availability-nfs">
<span id="cephadm-ha-nfs"></span><h2>High-availability NFS<a class="headerlink" href="#high-availability-nfs" title="Permalink to this headline">¶</a></h2>
<p>Deploying an <em>ingress</em> service for an existing <em>nfs</em> service will provide:</p>
<ul class="simple">
<li><p>a stable, virtual IP that can be used to access the NFS server</p></li>
<li><p>fail-over between hosts if there is a host failure</p></li>
<li><p>load distribution across multiple NFS gateways (although this is rarely necessary)</p></li>
</ul>
<p>Ingress for NFS can be deployed for an existing NFS service
(<code class="docutils literal notranslate"><span class="pre">nfs.mynfs</span></code> in this example) with the following specification:</p>
<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="nt">service_type</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">ingress</span>
<span class="nt">service_id</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">nfs.mynfs</span>
<span class="nt">placement</span><span class="p">:</span>
  <span class="nt">count</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">2</span>
<span class="nt">spec</span><span class="p">:</span>
  <span class="nt">backend_service</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">nfs.mynfs</span>
  <span class="nt">frontend_port</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">2049</span>
  <span class="nt">monitor_port</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">9000</span>
  <span class="nt">virtual_ip</span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">10.0.0.123/24</span>
</pre></div>
</div>
<p>A few notes:</p>
<blockquote>
<div><ul>
<li><p>The <em>virtual_ip</em> must include a CIDR prefix length, as in the
example above.  The virtual IP will normally be configured on the
first identified network interface that has an existing IP in the
same subnet.  You can also specify a <em>virtual_interface_networks</em>
property to match against IPs in other networks; see
<a class="reference internal" href="../rgw/#ingress-virtual-ip"><span class="std std-ref">Selecting ethernet interfaces for the virtual IP</span></a> for more information.</p></li>
<li><p>The <em>monitor_port</em> is used to access the haproxy load status
page.  The user is <code class="docutils literal notranslate"><span class="pre">admin</span></code> by default, but can be modified by
via an <em>admin</em> property in the spec.  If a password is not
specified via a <em>password</em> property in the spec, the auto-generated password
can be found with:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph config-key get mgr/cephadm/ingress.*<span class="o">{</span>svc_id<span class="o">}</span>*/monitor_password</span>
</pre></div></div><p>For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph config-key get mgr/cephadm/ingress.nfs.myfoo/monitor_password</span>
</pre></div></div></li>
<li><p>The backend service (<code class="docutils literal notranslate"><span class="pre">nfs.mynfs</span></code> in this example) should include
a <em>port</em> property that is not 2049 to avoid conflicting with the
ingress service, which could be placed on the same host(s).</p></li>
</ul>
</div></blockquote>
</div>
<div class="section" id="further-reading">
<h2>Further Reading<a class="headerlink" href="#further-reading" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li><p>CephFS: <a class="reference internal" href="../../../cephfs/nfs/#cephfs-nfs"><span class="std std-ref">NFS</span></a></p></li>
<li><p>MGR: <a class="reference internal" href="../../../mgr/nfs/#mgr-nfs"><span class="std std-ref">CephFS &amp; RGW Exports over NFS</span></a></p></li>
</ul>
</div>
</div>



           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="../iscsi/" class="btn btn-neutral float-right" title="iSCSI Service" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="../mds/" class="btn btn-neutral float-left" title="MDS Service" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>